package com.cmcc.driver.data

import androidx.lifecycle.MutableLiveData
import com.cmcc.driver.data.entity.OrderDetail


/**
 * Author: jiangxin
 * Date: 2019/11/14
 * Description:
 * 用于存储公用的数据
 */
class DriverDataRepository {

    private var order: MutableLiveData<OrderDetail>? = null


    fun getOrder(): MutableLiveData<OrderDetail> {
        if (order == null) order = MutableLiveData()
        return order ?: MutableLiveData()
    }


    private var statusChange :MutableLiveData<Boolean>? = null

    fun hasStatusChange():MutableLiveData<Boolean>{
        if(statusChange == null) statusChange = MutableLiveData()
        return statusChange?: MutableLiveData()
    }

    companion object {
        @Volatile
        private var instance: DriverDataRepository? = null

        fun getInstance(): DriverDataRepository {
            return instance ?: synchronized(this) {
                instance ?: DriverDataRepository().also { instance = it }
            }
        }
    }
}